package com.tianya.exception;

import com.tianya.domain.enums.Message;
import lombok.Getter;

/**
 * 自定义异常类
 */
@Getter
public class CustomException extends RuntimeException {

    private final int code;

    public CustomException(String message) {
        super(message);
        this.code = Message.ERROR.getCode();
    }

    public CustomException(int code, String message) {
        super(message);
        this.code = code;
    }

    public CustomException(Message messageEnum) {
        super(messageEnum.getMessage());
        this.code = messageEnum.getCode();
    }

}